<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="include/head::head('组卷系统后台 | 添加用户')"></head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

    <!--Main Header -->
    <div th:replace="/include/back_header::header"></div>
    <!-- Left side column. contains the logo and sidebar -->
    <div th:replace="/include/back_sidebar::sidebar"></div>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                添加用户
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                <li><a href="#">用户管理</a></li>
                <li class="active">添加用户</li>
            </ol>
        </section>
        <!-- Main content -->
        <section class="content">
            <div class="col-md-12">
                <!-- Horizontal Form -->
                <div class="box box-info">
                    <!-- form start -->
                    <form role="form" class="form-horizontal" th:action="@{/user-add}" method="post">
                        <div class="box-body">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">用户姓名</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control"  placeholder="用户姓名" name="userName">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">用户状态</label>
                                <div class="col-sm-8">
                                    <select id="userStatus" name="userStatus" class="form-control">
                                        <option th:each="status,memberStat:${userStatus}" th:value="${status.dicId}" th:text="${status.dicValue}"></option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">用户邮箱</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control"  placeholder="邮箱" name="userEmail" autocomplete="off">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">账户密码</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control"  placeholder="密码" name="userPassword" autocomplete="off">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">用户简介</label>
                                <div class="col-sm-8">
                                    <textarea class="form-control"  placeholder="用户简介" name="userProfile" style="height: 120px"></textarea>
                                </div>
                            </div>

                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <button type="submit" class="btn btn-info pull-right">提交</button>
                        </div>
                        <!-- /.box-footer -->
                    </form>
                </div>
                <!-- /.box -->
                <!-- general form elements disabled -->
            </div>
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    <!-- Main Footer -->
    <div th:replace="@{/include/back_footer}::footer"></div>

</div>
<!-- ./wrapper -->

<!-- REQUIRED JS SCRIPTS -->

<div th:replace="include/javascript::javascript"></div>
<!-- page script -->
<script>
    $(function () {
        $("#user-branch").addClass("active");
        $(".btn-delete").on("click", function () {
            var table = $("#example").DataTable();
            var row=table.row($(this).parents('tr'))
            var tr=$(this).parents("tr");
            var idValue=tr.find("td:eq(0)").html();
            var currentName=tr.find("td:eq(1)").html();

            layer.confirm('确定删除【 ' + currentName + "】", {icon: 3, title: '提示'}, function (index) {
                $.ajax({
                    type: "POST",
                    url: "${base}/customer/del",
                    data: {id: idValue},
                    dataType:"json",
                    success: function (msg) {
                        if(msg["ok"]){
                            layer.msg("操作成功", {time: 700}, function () {
                              //  window.location.reload();
                                row.remove().draw();
                            });

                        }
                    }
                });
                layer.close(index);
            });


        });
        $('#example').DataTable({
            'paging': true,
            'lengthChange': true,
            'searching': true,
            'ordering': true,
            'bAutoWidth': false,
            'info': true,
            'autoWidth': false
        });
    })


    $(".sidebar-menu li").click(function (e) {
        $(".sidebar-menu li").removeClass("active");
        $(this).addClass("active");
    });
</script>
</body>

</html>